//
//  ImageCollectionViewCell.m
//  B段项目
//
//  Created by 徐茂怀 on 15/11/11.
//  Copyright © 2015年 徐茂怀. All rights reserved.
//

#import "ImageCollectionViewCell.h"
#import "FitHeader.h"
@implementation ImageCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _MyImageView = [[UIImageView alloc]init];
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_MyImageView];
        [self.contentView addSubview:_titleLabel];
        
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont fontWithName:@"Helvetica-Light" size:15 * FitWidth];
        CGSize size = [[_titleLabel text] sizeWithFont:[UIFont systemFontOfSize:15.0 * FitWidth]];
        UIView *highlightView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
        [highlightView setBackgroundColor:[UIColor greenColor]];
        [self.titleLabel insertSubview:highlightView belowSubview:_titleLabel];
        [highlightView setCenter:_titleLabel.center];
        [_titleLabel setBackgroundColor:[UIColor colorWithRed:0.16 green:0.17 blue:0.21 alpha:.5]];
        
      
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _MyImageView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
     _titleLabel.frame = CGRectMake(0, self.contentView.frame.size.height - 20 * FitHeight, self.contentView.frame.size.width, 20 * FitHeight);
}

@end
